function [ s ] = calculate_puzzle_board( number )
%CALCULATE_PUZZLE_BOARD Summary of this function goes here
%   Detailed explanation goes here

%     if number not in range(0,factorial(9)):
%         print "ERROR, invalid number"
            
    s = zeros(1,9);
    available = 1:9;
        
    
    number = number -1;
    for k=1:9
       for i=1:(10-k)
           if factorial(9-k) * i - number > 0;
               s(k) = available(i);
               available = available([1:i-1 i+1:end]);
               number = number - factorial(9-k) * (i-1);
               break
           end
       end
    end
end

